import { assertEquals } from "asserts";
import { runScript } from "leetcode-class";

import DinnerPlates from "./index.ts";

Deno.test("dinner-plate-stacks", () => {
    assertEquals(
        runScript(
            [
                "DinnerPlates",
                "push",
                "push",
                "push",
                "push",
                "push",
                "popAtStack",
                "push",
                "push",
                "popAtStack",
                "popAtStack",
                "pop",
                "pop",
                "pop",
                "pop",
                "pop",
            ],
            [
                [2],
                [1],
                [2],
                [3],
                [4],
                [5],
                [0],
                [20],
                [21],
                [0],
                [2],
                [],
                [],
                [],
                [],
                [],
            ],
            DinnerPlates,
        ),
        [
            null,
            null,
            null,
            null,
            null,
            null,
            2,
            null,
            null,
            20,
            21,
            5,
            4,
            3,
            1,
            -1,
        ],
    );
});
Deno.test("dinner-plate-stacks", () => {
    assertEquals(
        runScript(
            [
                "DinnerPlates",
                "push",
                "push",
                "push",
                "push",
                "push",
                "popAtStack",
                "push",
                "push",
                "popAtStack",
                "popAtStack",
                "pop",
                "pop",
                "pop",
                "pop",
                "pop",
            ],
            [
                [2],
                [1],
                [2],
                [3],
                [4],
                [7],
                [8],
                [20],
                [21],
                [0],
                [2],
                [],
                [],
                [],
                [],
                [],
            ],
            DinnerPlates,
        ),
        [
            null,
            null,
            null,
            null,
            null,
            null,
            -1,
            null,
            null,
            2,
            20,
            21,
            7,
            4,
            3,
            1,
        ],
    );
});
